




#ifndef _VIN_H264_POST_DECODER_H_
#define _VIN_H264_POST_DECODER_H_

#include <fstream>
#include "VinDefines.h"

#include "VinH264Decoder.h"
using namespace std;


// Callback function to sink the decoded H264 frames.
static void decoderCallback (DecodedFrameList*    decProcData,
                             void*                inContext);




/*!
@class      PostDecoder.
@abstract   This class is responcible for handling the H264 decoded raw frame and writing into the file.
@descussion The filename of the decoded raw file to be written is regestered through the constructor method PostDecoder() with full path of the file. The 
            method decoderCallback() is called by the decoder with the decoded frame in DecodedFrameList structure. All these frames are writtten to the 
            decodeFileName file as specified by the constructor.

            In your applications you need to costumize the PostDecoder based on your needs.
*/
class PostDecoder
{
public:

    // Default constructor ot set the decoded file name.
    PostDecoder (char* decodeFileName);

    // Default destructor.
    ~PostDecoder ();

    // Function to register the callback function to the decoder.
    void RegisterFrameDecodeCompleteCallback (VinH264Decoder* decoder);

    // Function to write the decoded frames into the files.
    void writeFrame (UInt8* Frame,
                     UInt32 Length);

private:

    std::string fileName;
    ofstream* outFile; // The file stream object to write into.
};
 
#endif